//
//  FSNoteViewCell.m
//  Trade
//
//  Created by 刘沿 on 16/4/8.
//  Copyright © 2016年 刘沿. All rights reserved.
//

#import "FSNoteViewCell.h"

@implementation FSNoteViewCell

+(instancetype)cellWithTableView:(UITableView*)tableView{
    static NSString * cellIdentifier = @"NoteCell";
    FSNoteViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell  = [[[NSBundle mainBundle] loadNibNamed:@"FSNoteViewCell" owner:nil options:nil] lastObject];
    }
    
    return cell;
}

-(void)setModel:(FSNoteModel *)model{
    _model = model;
    self.titleLabel.text = model.title;
    if (model.time.length !=0 && model.state.length !=0 && model.name.length !=0) {
        self.desLabel.text = [NSString stringWithFormat:@"%@/%@/%@",model.time,model.state,model.name];
    }else if(model.time.length !=0 && model.state.length ==0 && model.name.length ==0){
        
        self.desLabel.text = [NSString stringWithFormat:@"%@",model.time];
    }else{
        self.desLabel.text = @"";
    }
    
//    icon 图片
    if([model.iconType isEqualToString:@"SendBox"]){
        self.imageView.image = [UIImage imageNamed:@"alread_read"];
    }else if ([model.iconType isEqualToString:@"InBox"]){
        if ([self.model.isRead isEqualToString:@"1"]) {
            self.desLabel.textColor = [UIColor grayColor];
            self.titleLabel.textColor = [UIColor grayColor];
            self.imageView.image = [UIImage imageNamed:@"alread_read"];
        }else{
            self.desLabel.textColor= [UIColor blackColor];
            self.titleLabel.textColor = [UIColor blackColor];
            self.imageView.image = [UIImage imageNamed:@"not_read"];
        }
        
    }else{
        //self.imageView.image = [UIImage imageNamed:@"fileicon"];
    }


}

@end
